<html>
<head><meta charset="utf-8"><title>How feasible is it to store a `Resolver` in TyCtxt? · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/How.20feasible.20is.20it.20to.20store.20a.20.60Resolver.60.20in.20TyCtxt.3F.html">How feasible is it to store a `Resolver` in TyCtxt?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="206891579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/How%20feasible%20is%20it%20to%20store%20a%20%60Resolver%60%20in%20TyCtxt%3F/near/206891579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/How.20feasible.20is.20it.20to.20store.20a.20.60Resolver.60.20in.20TyCtxt.3F.html#206891579">(Aug 14 2020 at 01:58)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/66159#issuecomment-550530324">https://github.com/rust-lang/rust/issues/66159#issuecomment-550530324</a> popped up again in <a href="https://github.com/rust-lang/rust/pull/75176">https://github.com/rust-lang/rust/pull/75176</a>:</p>
<blockquote>
<p>My gut feeling is that we probably need to stop capturing/cloning the resolver as we do here: <a href="https://github.com/rust-lang/rust/blob/master/src/librustdoc/core.rs#L346">https://github.com/rust-lang/rust/blob/master/src/librustdoc/core.rs#L346</a> and instead try and find a resolver as part of the closure here: <a href="https://github.com/rust-lang/rust/blob/master/src/librustdoc/core.rs#L354">https://github.com/rust-lang/rust/blob/master/src/librustdoc/core.rs#L354</a></p>
<p>Of course, it looks like a <code>TyCtxt</code> has an immutable copy of the resolver's outputs, and no access to the resolver itself, urgh, and we have no easy way to inject changes into the context at this point.</p>
</blockquote>
<p>Is it feasible to store the resolver itself into the TyCtxt? I <a href="https://github.com/rust-lang/rust/compare/master...jyn514:no-clone?expand=1#diff-0de644786a2f1fd88c7d7f44bc3fa4bbR453">tried calculating them separately</a> but it panicked with</p>
<div class="codehilite"><pre><span></span><code>thread &#39;rustc&#39; panicked at &#39;attempt to read from stolen value&#39;, /home/joshua/rustc/src/librustc_middle/ty/steal.rs:42:15
</code></pre></div>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>